var MeasureToolInfoTableInit = function () {
    var oTableInit = {};
    //初始化Table
    oTableInit.Init = function () {
        $('#measureToolInfoTable').bootstrapTable({
            url: ctx + '/measureTool/measureToolInfo/getMeasureToolByFilter/get.mvc',         //请求后台的URL（*）
            method: 'get',                      //请求方式（*）
//            toolbar: '#toolbar',                //工具按钮用哪个容器
            striped: true,                      //是否显示行间隔色
            cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
            pagination: true,                   //是否显示分页（*）
            paginationLoop: false,
            sortable: true,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            queryParams: oTableInit.queryParams,//传递参数（*）
            sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
            strictSearch: true,
            showColumns: false,                  //是否显示所有的列
            showRefresh: false,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
            height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "pkId",                     //每一行的唯一标识，一般为主键列
            showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
            cardView: false,                    //是否显示详细视图
            detailView: false,                   //是否显示父子表
            singleSelect: false,                    //禁止多选
            checkboxHeader: true,                 //列头取消多选
            columns: [
                {
                    checkbox: true,
                    align: 'center',
                    valign: 'middle'
                },
                {
                    title: '序号',
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                        var options = $('#measureToolInfoTable').bootstrapTable('getOptions');
                        return options.pageSize * (options.pageNumber - 1) + index + 1;
                    }
                },
                {
                    field: 'measureToolCode',
                    title: '计量器具编码',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'measureToolName',
                    title: '计量器具名称',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'measureToolModel',
                    title: '规格型号',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'supplier',
                    title: '供应商名称',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'

                }, {
                    field: 'areaName',
                    title: '使用区域',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'department',
                    title: '使用部门',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'dutyUserName',
                    title: '责任人',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'productionDate',
                    title: '投产日期',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'checkTypeValue',
                    title: '检验类别',
                    sortable: false,
                    align: 'center',
                    valign: 'middle'
                }, {
                    field: 'checkFlag',
                    title: '是否校验',
                    sortable: false,
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                        if("1" === value) {
                            return "是"
                        } else if("0" === value){
                            return "否"
                        } else {
                            return ""
                        }
                    }
                }, {
                    field: '',
                    title: '操作',
                    sortable: false,
                    align: 'center',
                    valign: 'middle',
                    formatter: function (value, row, index) {
                        return "<a href='javascript:;' class='click_btn detail' data-pkid='" + row.pkId + "'>详情查看</a>";
                    }
                }, {
                    field: 'pkId',
                    title: 'pkId',
                    visible: false
                }]

        });
    };
    //得到查询的参数
    oTableInit.queryParams = function (params) {
        return {   // 这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            size: params.limit,   // 页面大小
            num: (params.offset/params.limit) + 1,  // 页码
            sort: params.sort,
            order: params.order,
            measureToolCode: $("#measureToolCode").val(),
            measureToolName: $("#measureToolName").val(),
            measureToolModel: $("#measureToolModel").val(),
            supplier: $("#supplier").val(),
            dutyUser: $("#dutyUser").val()
        };
    };
    return oTableInit;
};

jQuery(document).ready(function () {
    //1.初始化Table
    var oTable = new MeasureToolInfoTableInit();
    oTable.Init();
    //初始化页面
    measureToolInfoInit.init();
    //文件上传
});


var measureToolInfoInit = function () {
    var dutyUserSelect2;
    return {
        init: function () {
            SystemCommon.getSysDict('CHECK_TYPE','check-type');
            measureToolInfoInit._validatorForm();
            measureToolInfoInit._initAreaSelect();
            measureToolInfoInit._query();
            measureToolInfoInit._keyQuery();
            measureToolInfoInit._reset();
            measureToolInfoInit._refresh();
            measureToolInfoInit._add();
            measureToolInfoInit._initDateControl();
            dutyUserSelect2 = measureToolInfoInit._initDutyUserSelect2();
            measureToolInfoInit._initDutyUserQuerySelect2();
            measureToolInfoInit._validateFormExtend();
            measureToolInfoInit._save();
            measureToolInfoInit._update();
            measureToolInfoInit._detail();
            measureToolInfoInit._modalHidden();

        },
        //条件查询
        _query: function () {
            $("#queryMeasureTool").on("click", function () {
                $('#measureToolInfoTable').bootstrapTable('refreshOptions', {
                    pageNumber: 1
                });
            });
        },
        //按键查询
        _keyQuery: function () {
            $(".measure-tool-query").keypress(function (e) {
                if (e.which === 13) {
                    $("#queryMeasureTool").trigger("click");
                }
            });
        },
        //重置查询
        _reset: function () {
            $(".reset").on("click", function () {
                $(".clearfix input").val("");
                $("#dutyUser").val(null).trigger("change");
            });
        },
        _refresh: function () {
            //刷新
            $("#refreshTable").on("click", function () {
                $('#measureToolInfoTable').bootstrapTable('refresh');
            });
        },
        //新增
        _add: function () {
            $("#add").on('click', function (e) {
                e.preventDefault();
                $('#myModal .title').html("新增");
                $.fn.modal.Constructor.prototype.enforceFocus = function () {
                    $("#myModal select").focus();
                };
                $("#measureToolInfoForm").find("input:radio[name=checkFlag][value='1']").prop("checked", "checked");
                $('#myModal').modal();
                measureToolInfoInit._changeValidate("1");
            });
        },
        _initAreaSelect : function () {
            $.ajax({
                url: ctx +'/factory/area/listAllArea/get.mvc',
                type:"post",
                aysnc: false,
                dataType:'json',
                data : '',
                success : function(response){
                    if(response.result === true) {
                        var _data = response.data;
                        $("#measureToolInfoForm select[name=areaCode]").append("<option value='' >请选择</option>");
                        for (var i = 0; i < _data.length; i++) {
                            $("#measureToolInfoForm select[name=areaCode]").append("<option value='"+_data[i].locationCode+"' >" + _data[i].locationName + "</option>");
                        }
                    } else {
                        DialogUtil.error(response.message);
                    }
                },
                error: function(){
                    DialogUtil.error("系统繁忙！");
                }
            });
        },
        _initDateControl: function () {
            $('.form-datetime').datetimepicker({
                format: 'yyyy-mm-dd hh:ii:ss',
                language: 'zh-CN',
                autoclose: true,
                pickerPosition: "bottom-left",
                //endDate : new Date(),
                forceParse: true
            }).on('hide', function (event) {
                event.preventDefault();
                event.stopPropagation();
            });
            $('.form-datetime-day').datetimepicker({
                format: 'yyyy-mm-dd',
                minView: 2,
                autoclose: true,
                language: 'zh-CN',
                pickerPosition: "bottom-left",
                //endDate : new Date(),
                forceParse: true
            }).on('hide', function (event) {
                event.preventDefault();
                event.stopPropagation();
            });
        },
        _initDutyUserSelect2: function () {
            var select2 = $('#dutyUserFormSelect2').select2({
                ajax: {
                    url: ctx + '/system/user/getSysUserList/get.mvc',
                    dataType: 'json',
                    aynsc: false,
                    data: function (params) {
                        // Query parameters will be ?search=[term]&page=[page]
                        return {
                            search: params.term,
                            page: params.page || 1,
                            size: 10
                        };
                    },
                    processResults: function (data) {
                        // Tranforms the top-level key of the response object from 'items' to 'results'
                        var test = [];
                        for (var int = 0; int < data.data.length; int++) {
                            var obj = {};
                            obj.id = data.data[int].username;
                            obj.text = data.data[int].truename;
                            test.push(obj);
                        }
                        return {
                            results: test
                        };
                    },
                    // Additional AJAX parameters go here; see the end of this chapter for the full code of this example
                    cache: true

                },
                placeholder: '请选择',
                language: "zh-CN",
                escapeMarkup: function (markup) {
                    return markup;
                }, // let our custom formatter work
                minimumInputLength: 0
            });
            return select2;
        },
        _initDutyUserQuerySelect2: function () {
            $('#dutyUser').select2({
                ajax: {
                    url: ctx + '/system/user/getSysUserList/get.mvc',
                    dataType: 'json',
                    aynsc: false,
                    data: function (params) {
                        // Query parameters will be ?search=[term]&page=[page]
                        return {
                            search: params.term,
                            page: params.page || 1,
                            size: 10
                        };
                    },
                    processResults: function (data) {
                        // Tranforms the top-level key of the response object from 'items' to 'results'
                        var test = [];
                        for (var int = 0; int < data.data.length; int++) {
                            var obj = {};
                            obj.id = data.data[int].username;
                            obj.text = data.data[int].truename;
                            test.push(obj);
                        }
                        return {
                            results: test
                        };
                    },
                    // Additional AJAX parameters go here; see the end of this chapter for the full code of this example
                    cache: true

                },
                placeholder: '请选择',
                language: "zh-CN",
                escapeMarkup: function (markup) {
                    return markup;
                }, // let our custom formatter work
                minimumInputLength: 0
            });
        },
        //删除
        _delete: function () {
            $("#delete").on("click", function () {
                var ids = $.map($('#measureToolInfoTable').bootstrapTable('getSelections'), function (row) {
                    return row.pkId;
                });
                if (ids.length < 1) {
                    DialogUtil.warning("请选择需要删除的记录");
                    return false;
                }
                DialogUtil.ok_and_cancel("是否确定删除记录？", function () {
                    $.ajax({
                        url: ctx + '/measureTool/measureToolInfo/deleteMeasureTool/del.mvc',
                        type: "post",
                        dataType: 'json',
                        data: {
                            pkIds: ids.toString()
                        },
                        success: function (response) {
                            console.log(response);
                            if (response.result === true) {
                                DialogUtil.warning("删除成功");
                                $('#measureToolInfoTable').bootstrapTable('refresh');
                            } else {
                                DialogUtil.error(response.message);
                            }
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            DialogUtil.error(errorThrown);
                        }
                    });
                }, function () {

                });
            });
        },
        //修改
        _update: function () {
            $("#update").on("click", function (e) {
                e.preventDefault();
                $('#myModal .title').html("修改");
                var ids = $.map($('#measureToolInfoTable').bootstrapTable('getSelections'), function (row) {
                    return row.pkId;
                });
                if (ids.length !== 1) {
                    DialogUtil.warning("请选择一行修改");
                    return false;
                }
                //解决select2无法输入问题
                $.fn.modal.Constructor.prototype.enforceFocus = function () {
                    $("#myModal select").focus();
                };
                //加载信息
                $.ajax({
                    url: ctx + "/measureTool/measureToolInfo/getMeasureToolInfoById/get.mvc",
                    type: "post",
                    dataType: "json",
                    data: {
                        pkId: ids.toString()
                    },
                    success: function (response) {
                        if (response.result === true && response.data) {
                            var _data = response.data;

                            $("#measureToolInfoForm").find("input[name=pkId]").val(_data.pkId);
                            $("#measureToolInfoForm").find("input[name=measureToolCode]").val(_data.measureToolCode);
                            $("#measureToolInfoForm").find("input[name=measureToolModel]").val(_data.measureToolModel);
                            $("#measureToolInfoForm").find("input[name=dividingValue]").val(_data.dividingValue);
                            $("#measureToolInfoForm").find("input[name=tolerance]").val(_data.tolerance);
                            $("#measureToolInfoForm").find("input[name=department]").val(_data.department);
                            $("#measureToolInfoForm").find("input[name=checkCycle]").val(_data.checkCycle);
                            $("#measureToolInfoForm").find("input[name=supplier]").val(_data.supplier);
                            $("#measureToolInfoForm").find("input[name=remark]").val(_data.remark);
                            $("#measureToolInfoForm").find("select[name=status]").val(_data.status);
                            $("#measureToolInfoForm").find("input[name=measureToolName]").val(_data.measureToolName);
                            $("#measureToolInfoForm").find("input[name=measureRange]").val(_data.measureRange);
                            $("#measureToolInfoForm").find("input[name=productionDate]").val(_data.productionDate);
                            $("#measureToolInfoForm").find("select[name=areaCode]").val(_data.areaCode);
                            $("#measureToolInfoForm").find("select[name=checkType]").val(_data.checkType);
                            $("#measureToolInfoForm").find("input[name=checkDate]").val(_data.checkDate);
                            if (_data.checkFlag && _data.checkFlag !== '') {
                                $("#measureToolInfoForm").find("input:radio[name=checkFlag][value=" + _data.checkFlag + "]").prop("checked", "checked");
                            }
                            measureToolInfoInit._changeValidate(_data.checkFlag);
                            //初始化用户
                            var userId = _data.dutyUser;
                            var userName = _data.dutyUserName;
                            if (userId != null && userName != null) {
                                var option = new Option(userName, userId, true, true);
                                dutyUserSelect2.append(option);
                                dutyUserSelect2.trigger("change");
                            }
                            $('#myModal').modal();

                        } else {
                            DialogUtil.error(response.message);
                        }
                    },
                    error: function () {
                        DialogUtil.error("系统繁忙！");
                    }
                });

            });
        },
        _detail: function () {
            $("#measureToolInfoTable").on("click", "a.detail",function (e) {
                e.preventDefault();
                $('#measureToolDetailForm .title').html("详情");
                var pkId = $(this).data("pkid");
                //加载信息
                $.ajax({
                    url: ctx + "/measureTool/measureToolInfo/getMeasureToolInfoById/get.mvc",
                    type: "post",
                    dataType: "json",
                    data: {
                        pkId: pkId.toString()
                    },
                    success: function (response) {
                        if (response.result === true && response.data) {
                            var _data = response.data;

                            $("#measureToolDetailForm").find("input[name=measureToolCode]").val(_data.measureToolCode);
                            $("#measureToolDetailForm").find("input[name=measureToolModel]").val(_data.measureToolModel);
                            $("#measureToolDetailForm").find("input[name=dividingValue]").val(_data.dividingValue);
                            $("#measureToolDetailForm").find("input[name=tolerance]").val(_data.tolerance);
                            $("#measureToolDetailForm").find("input[name=department]").val(_data.department);
                            $("#measureToolDetailForm").find("input[name=checkCycle]").val(_data.checkCycle);
                            $("#measureToolDetailForm").find("input[name=supplier]").val(_data.supplier);
                            $("#measureToolDetailForm").find("input[name=remark]").val(_data.remark);
                            $("#measureToolDetailForm").find("select[name=status]").val(_data.status);
                            $("#measureToolDetailForm").find("input[name=measureToolName]").val(_data.measureToolName);
                            $("#measureToolDetailForm").find("input[name=measureRange]").val(_data.measureRange);
                            $("#measureToolDetailForm").find("input[name=productionDate]").val(_data.productionDate);
                            $("#measureToolDetailForm").find("input[name=areaName]").val(_data.areaName);
                            $("#measureToolDetailForm").find("select[name=checkType]").val(_data.checkType);
                            $("#measureToolDetailForm").find("input[name=checkDate]").val(_data.checkDate);
                            $("#measureToolDetailForm").find("input[name=dutyUserName]").val(_data.dutyUserName);
                            $("#measureToolDetailForm").find("input[name=checkFlag]").val(_data.checkFlag === '1'?'是':'否');
                            $('#detailModal').modal();

                        } else {
                            DialogUtil.error(response.message);
                        }
                    },
                    error: function () {
                        DialogUtil.error("系统繁忙！");
                    }
                });

            });
        },
        //表单校验
        _validatorForm: function () {
            $("#measureToolInfoForm").bootstrapValidator({
                message: 'This value is not valid',
                live: 'submitted',
                fields: {
                    /*验证*/
                    measureToolCode: {
                        message: '',
                        validators: {
                            notEmpty: {
                                message: '不能为空'
                            },
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    measureToolName: {
                        message: '',
                        validators: {
                            notEmpty: {
                                message: '不能为空'
                            },
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    supplier: {
                        message: '',
                        validators: {
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    measureRange: {
                        message: '',
                        validators: {
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    measureToolModel: {
                        message: '',
                        validators: {
                            notEmpty: {
                                message: '不能为空'
                            },
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    dividingValue: {
                        message: '',
                        validators: {
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    tolerance: {
                        message: '',
                        validators: {
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    department: {
                        message: '',
                        validators: {
                            stringLength: {
                                max: 20,
                                message: '不能超过20个字符'
                            }
                        }
                    },
                    remark: {
                        message: '',
                        validators: {
                            stringLength: {
                                max: 30,
                                message: '不能超过30个字符'
                            }
                        }
                    },
                    checkCycle: {
                        message: '',
                        validators: {
                            notEmpty: {
                                message: '不能为空'
                            },
                            regexp: {
                                regexp:   /^[1-9]\d*$/,
                                message: '输入正整数'
                            }
                        }
                    },
                    checkDate: {
                        message: '',
                        validators: {
                            notEmpty: {
                                message: '不能为空'
                            }
                        }
                    },
                    checkType: {
                        message: '',
                        validators: {
                            notEmpty: {
                                message: '不能为空'
                            }
                        }
                    }
                }
            });
        },
        _validateFormExtend: function () {
            $("#measureToolInfoForm").find("input[name=checkFlag]").on("change", function () {
                var checkFlag = $("#measureToolInfoForm").find("input[name=checkFlag]:checked").val();
                measureToolInfoInit._changeValidate(checkFlag);
            });
        },
        //保存
        _save: function () {
            $("#myModal .yes").on("click", function (e) {
                $("#myModal .yes").attr("disabled", true);
                e.preventDefault();
                $("#measureToolInfoForm").data("bootstrapValidator").validate();
                var flag = $("#measureToolInfoForm").data("bootstrapValidator").isValid();
                if (!flag) {
                    $("#myModal .yes").attr("disabled", false);
                    //未通过验证
                    return false;
                }
                var entity = {};
                entity['pkId'] = $("#measureToolInfoForm").find("input[name=pkId]").val();
                entity['measureToolCode'] = $("#measureToolInfoForm").find("input[name=measureToolCode]").val();
                entity['measureToolModel'] = $("#measureToolInfoForm").find("input[name=measureToolModel]").val();
                entity['dividingValue'] = $("#measureToolInfoForm").find("input[name=dividingValue]").val();
                entity['tolerance'] = $("#measureToolInfoForm").find("input[name=tolerance]").val();
                entity['department'] = $("#measureToolInfoForm").find("input[name=department]").val();
                entity['checkFlag'] = $("#measureToolInfoForm").find("input:radio[name=checkFlag]:checked").val();
                entity['checkCycle'] = $("#measureToolInfoForm").find("input[name=checkCycle]").val();
                entity['remark'] = $("#measureToolInfoForm").find("input[name=remark]").val();
                entity['measureToolName'] = $("#measureToolInfoForm").find("input[name=measureToolName]").val();
                entity['supplier'] = $("#measureToolInfoForm").find("input[name=supplier]").val();
                entity['measureRange'] = $("#measureToolInfoForm").find("input[name=measureRange]").val();
                entity['productionDate'] = $("#measureToolInfoForm").find("input[name=productionDate]").val();
                entity['areaCode'] = $("#measureToolInfoForm").find("select[name=areaCode]").val();
                entity['areaName'] = $("#area").find("option:selected").text();
                entity['checkType'] = $("#measureToolInfoForm").find("select[name=checkType]").val();
                entity['checkDate'] = $("#measureToolInfoForm").find("input[name=checkDate]").val();
                entity['dutyUser'] = $("#measureToolInfoForm").find("select[name=dutyUser]").val();
                console.log(entity);
                $.ajax({
                    url: ctx + '/measureTool/measureToolInfo/saveOrUpdateMeasureTool/save.mvc',
                    type: "post",
                    dataType: 'json',
                    data: entity,
                    success: function (response) {
                        if (response.result === true) {
                            DialogUtil.ok("保存成功");
                            //取消
                            $('#myModal').modal('hide');
                            $('#measureToolInfoTable').bootstrapTable('refresh');
                        } else {
                            DialogUtil.error(response.message);
                        }
                        $("#myModal .yes").attr("disabled", false);

                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $("#myModal .yes").attr("disabled", false);
                        console.log(errorThrown);
                        DialogUtil.error("系统错误");
                    }
                });

            });
        },
        _changeValidate : function (checkFlag) {
            if(checkFlag) {
                if("1" === checkFlag) {
                    $("#checkCycleDiv label").removeClass("form-required")
                        .removeClass("form-required-6")
                        .addClass("form-required")
                        .addClass("form-required-6");
                    $("#checkTypeDiv label").removeClass("form-required")
                        .removeClass("form-required-4")
                        .addClass("form-required")
                        .addClass("form-required-4");
                    $("#checkDateDiv label").removeClass("form-required")
                        .removeClass("form-required-6")
                        .addClass("form-required")
                        .addClass("form-required-6");
                    debugger
                    $('#measureToolInfoForm').data('bootstrapValidator').enableFieldValidators('checkDate', true);
                    $('#measureToolInfoForm').data('bootstrapValidator').enableFieldValidators('checkCycle', true);
                    $('#measureToolInfoForm').data('bootstrapValidator').enableFieldValidators('checkType', true);
                } else {
                    $("#checkCycleDiv label").removeClass("form-required")
                        .removeClass("form-required-6");
                    $("#checkTypeDiv label").removeClass("form-required")
                        .removeClass("form-required-4");
                    $("#checkDateDiv label").removeClass("form-required")
                        .removeClass("form-required-6");
                    $('#measureToolInfoForm').data('bootstrapValidator').enableFieldValidators('checkDate', false);
                    $('#measureToolInfoForm').data('bootstrapValidator').enableFieldValidators('checkCycle', false);
                    $('#measureToolInfoForm').data('bootstrapValidator').enableFieldValidators('checkType', false);
                }
            }
            
        },
        _modalHidden: function () {
            //模态框消失清空信息
            $("#myModal").on("hide.bs.modal", function () {
                $('#myModal input').each(function () {
                    if ($(this).val() !== "" && $(this).attr("name") !== 'checkFlag') {
                        $(this).val("");
                    }
                });
                $("#measureToolInfoForm").find("select[name=areaCode]").val("");
                $("#measureToolInfoForm").find("select[name=checkType]").val("");
                $('#dutyUserFormSelect2').val(null).trigger("change");
                $("#measureToolInfoForm").find("input:radio[name=checkFlag][value='1']").prop("checked", "checked");
                $('#measureToolInfoForm').bootstrapValidator('resetForm', false);
            });
            $("#detailModal").on("hide.bs.modal", function () {
                $('#detailModal input').each(function () {
                    if ($(this).val() !== "" ) {
                        $(this).val("");
                    }
                });
                $("#measureToolInfoForm").find("select[name=checkType]").val("");
                $("#measureToolInfoForm").find("input:radio[name=checkFlag][value='1']").prop("checked", "checked");
            });
        }
    }
}();